<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="keywords" content="动力金融网，动力金融，动力金融财富,金元宝，金元宝，网络理财，个人理财，投资理财，P2P理财，互联网金融，投资理财，债权转让，理财，网络贷款，个人贷款，理财服务，网贷，小额贷款，网络投融资平台, 网络理财,固定收益,100%本息保障" />
<meta name="description" content="动力金融网用户注册，专业的互联网金融信息服务平台"/>
<title>登录动力金融网-动力金融网,专业的互联网金融信息服务平台</title>
<link rel="stylesheet" type="text/css" th:href="@{/static/css/style.css}"/>
<script language="javascript" type="text/javascript" th:src="@{/static/js/jquery-1.7.2.min.js}"></script>
<script language="javascript" type="text/javascript" th:src="@{/static/js/jQuery.md5.js}"></script>
<script language="javascript" type="text/javascript" th:src="@{/static/js/login.js}"></script>
    <script type="text/javascript">
        $(function () {
            $('#captcha').blur(function () {
                //验证格式
                var captcha = $(this).val();
                var reg = /^[a-zA-Z]{4}$/;
                if(reg.test(captcha)===false){
                    showError('captcha', '请输入4位验证码');
                }else{
                    showSuccess('captcha');
                }
                $.ajax({
                    url:"doCaptcha",
                    data:{
                        captcha:captcha
                    },
                    success:function (result) {
                        if (result ===true ){
                            showSuccess('captcha');
                        }
                    }
                })
            })
            $('#imgCode').click(function () {
                $(this).attr('src','/money/jcaptcha/captcha');
            });
            $("#btnLogin").click(function () {
                var phone = $.trim($("#phone").val());

                var loginPassword =  $.md5($.trim($("#loginPassword").val()));
                if (phone == "") {
                    alert("请输入用户名");
                    return false;
                } else if (loginPassword == "") {
                    alert("请输入密码");
                    return false;
                }
                $('#captcha').blur();
                //获取所有的报错信息
                var error = $('div[id$="Err"]').text();
                //如果报错信息不为空，则验证失败
                if(error!==''){
                    return;
                }
                $.ajax({
                    type : 'POST',
                    url : 'loan/do-login',
                    dataType:"json",
                    data : {
                        phone : phone,
                        loginPassword : loginPassword
                    },
                    success : function(data) {
                        if (data == null) {
                            alert("用户名或密码错误！")
                        } else {
                            window.location.href = "/money/index";

                        }
                    },

                });
        })
        })
        // onclick触发js
/*        function Login() {
            var phone = $.trim($("#phone").val());

            var loginPassword =  $.md5($.trim($("#loginPassword").val()));
            if (phone == "") {
                alert("请输入用户名");
                return false;
            } else if (loginPassword == "") {
                alert("请输入密码");
                return false;
            }
            $('#captcha').blur();
            //获取所有的报错信息
            var error = $('div[id$="Err"]').text();
            //如果报错信息不为空，则验证失败
            if(error!==''){
                return;
            }
            $.ajax({
                type : 'POST',
                url : 'loan/do-login',
                dataType:"json",
                data : {
                    phone : phone,
                    loginPassword : loginPassword
                },
                success : function(data) {
                    if (data == null) {
                        alert("用户名或密码错误！")
                    } else {
                        window.location.href = "/money/index";

                    }
                },

            });
        }*/


        function showError(id,msg) {
            $("#"+id+"Ok").hide();
            $("#"+id+"Err").html("<i></i><p>"+msg+"</p>");
            $("#"+id+"Err").show();
            $("#"+id).addClass("input-red");
        }
        //显示成功
        function showSuccess(id) {
            $("#"+id+"Err").hide();
            $("#"+id+"Err").html("");
            $("#"+id+"Ok").show();
            $("#"+id).removeClass("input-red");
        }
    </script>
</head>

<body>
<!--页头start-->
<div id="header">
    <div th:include="commons/header :: html"></div>
</div>
<!--页头end-->

<div class="login-body">
  <div class="mainBox">
    <div class="homeWap">
      <div class="login-cnt clearfix">
        <div class="login-form">
		     <h2>欢迎登录</h2>
		     
		     <div class="login-box clearfix" style="z-index:10;">
		     <label>账号</label>
		     	<input id="phone" name="phone" type="text" class="input_text" placeholder="请输入11位手机号码" maxlength="11"/>
		     </div>
		     
		     <div class="login-box clearfix" style="z-index:8; padding-bottom:0px;">
		     <label>密码</label>
		     	<input id="loginPassword" name="loginPassword" type="password" placeholder="请输入登录密码" class="input_text" maxlength="16"/>
		     </div>


		     <div class="login-yzm">
		     <div id="showCaptcha" class="yzm-box" style="display:block;">
			 	<input id="captcha" type="text" class="yzm" placeholder="点击右侧图片可刷新"/>
			 	<img th:src="@{/jcaptcha/captcha}" id="imgCode" style="cursor:pointer;border:0; display:inline;vertical-align:middle;"/>
                <!-- <span id="captchaOk" class="ok" style="display:none;"></span>-->
                 <div id="captchaErr" class="form-hint" style="display:none;"></div>
		     </div>
		     <ul><li id="showId" style="color:red;font-size:12px;width:222px;margin-top:10px;margin-bottom:10px;line-height:18px;"></li></ul>
		     </div>


            <!--onclick="Login()"-->
		     <div class="bn-login" id="loginId"><button  id="btnLogin">登&nbsp;&nbsp;录</button></div>
    	</div>
    	
        <div class="login-right">
          <div class="login-boy"></div>
          <div class="top-txt">
		          动力金融网，便捷的投资平台
			<br/><br/>
			加入动力金融网<br/>坐享12.7%历史年化收益
          </div>
           
          <div class="currently">
          	平台用户数：<span id="user">--</span>位，累计成交额： <span id="gold">--</span>元
          </div>
          
          <div class="bn-reg" id="quickRegBtn">
          </div>
          
           <ul class="clearfix">
            <li><i></i>
              <h3>优选投资计划</h3>
              <p>
              	历史年化收益<span>12.7%</span><br/> 投资周期<span>1-12月</span>灵活选择
              </p>
            </li>
            <li class="jpsb"><i></i>
              <h3>优质借款</h3>
              <p>
              	投资周期短<br/>安全计划
              </p>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</div>

<!--页脚start-->
<div th:include="commons/footer :: html"></div>
<!--页脚end-->
</body>
</html>